#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@crane-pc>
#
# Distributed under terms of the MIT license.

"""

"""

# 这里不用map也可以, 直接返回2^n次方即可, 不过为了可读性, 放在这里
map = {
    0: 1,
    1: 2,
    2: 4,
    3: 8
}

def hex_of_2_power(power):
    # 2的power次方的16进制表示
    # 2的4次方, 返回"0x1"
    n_of_four = power // 4
    remain = power % 4

    return "0x" + str(map[remain]) + "0" * n_of_four
    return "0x" + str(2**remain) + "0" * n_of_four


def main():
    print("start main")

    print(hex_of_2_power(4))
    print(hex_of_2_power(8))
    print(hex_of_2_power(3))
    print(hex_of_2_power(11))
    print(hex_of_2_power(12))
    print(hex_of_2_power(13))
    print(hex_of_2_power(14))

if __name__ == "__main__":
    main()
